#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

const int MAXN = 60 + 10;
const int MOD = 1e9 + 7;

int t,n,a[MAXN];
int main() {
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0);
    cin>>t;
    while(t--){
        cin>>n;
        int cnt0 = 0, cnt1 = 0;
        for(int i=1; i<=n;i++) {
            cin>>a[i];
            if (a[i]==1) cnt1++;
            if (a[i] == 0) cnt0++;
        }
        ll res = cnt1*(1ll<<cnt0);
        cout << res << endl;
    }
    return 0;
}